////////////////////////////////////////////////////////////////////////
// This file is part of the simpleSID framework 
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
//
// Copyright (c)Richard White, 2009
// See License.txt for a disclaimer of all warranties
// and licensing information

// SID SoundDlg.h : header file
//

#pragma once
#include "SID/RWSID.h"
#include "SID/portaudio.h"
#include "afxwin.h"

struct Notes
{
	unsigned char HighByte;
	unsigned char LowByte;
};

struct FiltFreq
{
	unsigned char FCLo;
	unsigned char FCHi;
	float freq;
};


// CSIDSoundDlg dialog
class CSIDSoundDlg : public CDialog
{
// Construction
public:
	CSIDSoundDlg(CWnd* pParent = NULL);	// standard constructor
	static const Notes SIDNotes[];
	FiltFreq m_FiltFreqs[2048];
// Dialog Data
	enum { IDD = IDD_SIDSOUND_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	PaStream *m_pStream;
	RWSID m_mySid;

	void SetupPortAudio(RWSID &mySid);

	afx_msg void OnEnChangeFreqlo1();
	afx_msg void OnEnChangeFreqhi1();
	afx_msg void OnEnChangePwlo1();
	afx_msg void OnEnChangePwhi1();
	afx_msg void OnCbnSelchangeNotes1();
	afx_msg void OnCbnSelchangeWave1();
	afx_msg void OnBnClickedGate1();
	afx_msg void OnBnClickedSync1();
	afx_msg void OnBnClickedRingmod1();
	afx_msg void OnBnClickedTest1();
	afx_msg void OnEnChangeAttackdecay1();
	afx_msg void OnEnChangeSustainrelease1();
	afx_msg void OnBnClickedReset1();
	afx_msg void OnEnChangeFreqlo2();
	afx_msg void OnEnChangeFreqhi2();
	afx_msg void OnEnChangePwlo2();
	afx_msg void OnEnChangePwhi2();
	afx_msg void OnCbnSelchangeNotes2();
	afx_msg void OnCbnSelchangeWave2();
	afx_msg void OnBnClickedGate2();
	afx_msg void OnBnClickedSync2();
	afx_msg void OnBnClickedRingmod2();
	afx_msg void OnBnClickedTest2();
	afx_msg void OnEnChangeAttackdecay2();
	afx_msg void OnEnChangeSustainrelease2();
	afx_msg void OnBnClickedReset2();
	afx_msg void OnEnChangeFreqlo3();
	afx_msg void OnEnChangeFreqhi3();
	afx_msg void OnEnChangePwlo3();
	afx_msg void OnEnChangePwhi3();
	afx_msg void OnCbnSelchangeNotes3();
	afx_msg void OnCbnSelchangeWave3();
	afx_msg void OnBnClickedGate3();
	afx_msg void OnBnClickedSync3();
	afx_msg void OnBnClickedRingmod3();
	afx_msg void OnBnClickedTest3();
	afx_msg void OnEnChangeAttackdecay3();
	afx_msg void OnEnChangeSustainrelease3();
	afx_msg void OnBnClickedReset3();
	afx_msg void OnCbnSelchangeFc();
	afx_msg void OnEnChangeFclo();
	afx_msg void OnEnChangeFchi();
	afx_msg void OnEnChangeRes();
	afx_msg void OnCbnSelchangeMode();
	afx_msg void OnBnClickedFiltenable();
	afx_msg void OnEnChangeVol();
	afx_msg void OnBnClickedMutev1();
	afx_msg void OnBnClickedMutev2();
	afx_msg void OnBnClickedMutev3();

	CComboBox m_cmbWave1;
	CComboBox m_cmbWave2;
	CComboBox m_cmbWave3;
	CComboBox m_cmbNotes1;
	CComboBox m_cmbNotes2;
	CComboBox m_cmbNotes3;
	CComboBox m_cmbFC;
	CComboBox m_cmbMode;


	CString m_strFreqHi1;
	CString m_strFreqHi2;
	CString m_strFreqHi3;


	CString m_strFreqLo1;
	CString m_strFreqLo2;
	CString m_strFreqLo3;


	CString m_strPwHi1;
	CString m_strPwHi2;
	CString m_strPwHi3;


	CString m_strPwLo1;
	CString m_strPwLo2;
	CString m_strPwLo3;

	CString m_strAttackDecay1;
	CString m_strAttackDecay2;
	CString m_strAttackDecay3;

	CString m_strSustainRelease1;
	CString m_strSustainRelease2;
	CString m_strSustainRelease3;

	
	CString m_strFcHi;
	CString m_strFcLo;


	CString m_strRes;
	CString m_strVol;
	afx_msg void OnDestroy();
	afx_msg void OnBnClickedFiltv1();
	afx_msg void OnBnClickedFiltv2();
	afx_msg void OnBnClickedFiltv3();
	afx_msg void OnBnClickedFiltextin();
};
